import { useRequest } from '@/hooks';
import { updateRecruitOutwardsChannelDetail } from '../../service';

export default function useRecruitOutwardsChannelUpdate(onSuccess, onError) {
    const { loading, run } = useRequest(
        (outwardId, channelCode, json) => updateRecruitOutwardsChannelDetail(outwardId, channelCode, json),
        {
            manual: true,
            onSuccess: d => {
                const { code, msg } = d;
                if (code === 10000) {
                    onSuccess(msg);
                } else {
                    onError(msg);
                }
            }
        }
    );
    return [run, loading];
}
